package com.asiainfo.kbisheet.util;

import java.util.ArrayList;
import java.util.List;

import com.asiainfo.kbisheet.vo.ColumnVO;
import com.asiainfo.kbisheet.vo.DBTypeVO;
import com.asiainfo.kbisheet.vo.DataSourceVO;
import com.asiainfo.kbisheet.vo.DimVO;
import com.asiainfo.kbisheet.vo.FromToDateVO;
import com.asiainfo.kbisheet.vo.KbsSheetVO;
import com.asiainfo.kbisheet.vo.LabelValueVO;
import com.asiainfo.kbisheet.vo.QueryVO;
import com.asiainfo.kbisheet.vo.UserColumnHiddenVO;
import com.asiainfo.kbisheet.vo.WhereVO;

import groovy.sql.Sql;

/**
 * 数据库工具(Database Util)的接口定义
 * 
 * @author kyunra
 * 
 */
public interface DBU {
	public void setDbTypeVO(DBTypeVO dbTypeVO);
	
	public void setDataSourceVO(DataSourceVO dataSourceVO);
	
	/** 得到SQL实例 */
	public Sql getSQLInstance();

	/**
	 * 得到列的XML数据
	 * 
	 * @param dataBaseName
	 * @param tableName
	 * @return
	 */
	public String getColumnsXML(String dataBaseName, String tableName);
	
	
	public List<KbsSheetVO> getAllKbsSheetVOList();
	
	public KbsSheetVO loadKbsSheetVO4Id(String sheetId);
	
	public List<String> loadUserColumnSet(String userId,String sheetId);

	public FromToDateVO getDimDate(DimVO dimVO);
	
	public List<LabelValueVO> getDimList(DimVO dimVO);
	
	public String getDataXML(QueryVO queryVO);
	
	public boolean saveUserColumnSets(UserColumnHiddenVO userColumnHiddenVO);
	
	public String getWhereString(ArrayList<WhereVO> wheres,ArrayList<ColumnVO> columns);
	
	public String getUpperWhereString(ArrayList<WhereVO> wheres,ArrayList<ColumnVO> columns);
	
	public String getColumnString(QueryVO queryVO, boolean allExport);
	
	public String getOrderString(QueryVO queryVO);
	
	/**格式化日期列*/
	public String formatDateColumn(String columnName);
	
	public void close();

}
